-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(agenda): all day event offsets, locale display #3695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
79c204f
to
8148008
Compare
@glemco it seems like you're the de facto owner of the agenda app, so mentioning you here :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking care of this! I remember testing this across time-zones was quite convoluted and I didn't know about this Contract.
Added some minor comments but it looks good to me.
e315cac
to
2d4228f
Compare
Should be ready for a final review. Thanks! |
2d4228f
to
4354d46
Compare
Forgot to increment version and add the changelog entry... NOW we are good :) |
@tnyeanderson did you forget to push? There's still only one changed file in this PR |
Currently, allDay events are off by one day for negative timezones. Per the CalendarContract: If allDay is set to 1 eventTimezone must be "UTC" and the time must correspond to a midnight boundary. For example, in GMT-2:00, an all day event on December 2nd (beginning at 00:00:00) will be wrongly displayed as starting on December 1st, since the locale will determine that the event's start time is actually 22:00:00 on Dec 1. Source: https://developer.android.com/reference/android/provider/CalendarContract.Events.html This commit: * Corrects the offset back to UTC 00:00:00 for allDay events * Fixes the conditional for single-day all day events in showEvent() * Fixes the display of formatDateShort() for some English locales by also removing any trailing commas or whitespace when the year is removed
4354d46
to
bcf88c3
Compare
Sorry, was in a rush and didn't |
Nice work, thanks for the PR @tnyeanderson and the review @glemco! |
All-day events synchronized from Gadgetbridge always start at midnight UTC, which causes them to display as different days depending on time zone offset (specifically negative offsets display the date as one day early). This was previously fixed in the agenda app in pull request espruino#3695 (commit bcf88c3). This commit replicates that fix in the clockinfo that agenda provides.
Currently, allDay events are off by one day for negative timezones. Per the CalendarContract:
For example, in GMT-2:00, an all day event on December 2nd (beginning at 00:00:00) will be wrongly displayed as starting on December 1st, since the locale will determine that the event's start time is actually 22:00:00 on Dec 1.
Source:
https://developer.android.com/reference/android/provider/CalendarContract.Events.html
This commit:
Corrects the offset back to UTC 00:00:00 for allDay events
Fixes the conditional for single-day all day events in showEvent()
Fixes the display of formatDateShort() for some English locales by also removing any trailing commas or whitespace when the year is removed